<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>阿里面试</title>
</head>
<body>
<script>
    //找出最大
    var arr=[1,4,0,8,2,3];
    var s='2[abc]3[cd]ef';
    function getMaxFromArray(arr) {
        arr.sort();
        return arr[arr.length-1];
    }
    //console.log( getMaxFromArray(arr));

    //计算交集
    function getIntersection() {
        var len=arguments.length;
        var a=arguments;
        var l=[];
        var r=[];
        var c=[];
        for(var i=0;i<len;i++){
            if(a[i][0]<a[i][1]){
                l.push(a[i][0]);
                r.push(a[i][1]);
            }else{
                l.push(a[i][1]);
                r.push(a[i][0]);
            }
        }
        l.sort();
        r.sort();
        if(l[l.length-1]>=r[0]){
            return '没有交集';
        }else{
           c= [l[l.length-1],r[0]];
           return c;
        }
    }
    //console.log(getIntersection([1,3],[2,4],[3,5]));

    //比较版本号
    function compareVersion(version1, version2) {
        //首先版本号长度>第一个数字
        var a=Number(version1.split('.').join(""));
        var b=Number(version2.split('.').join(""));
        if(version1.split('.')[0]<version1.length&&version1.indexOf('-')===-1){
            if(a>b){
                return 1;
            }else if(a<b){
                return 0;
            }else{
                return -1;
            }
        }
    }
    //console.log(compareVersion('1.1.0','5.2.0'));

    //编码字符解码
    //var s='2[abc]3[cd]ef';
    function decodeString(str) {
        var s;
        var re=/[^0-9]+/g;
        var arr=str.replace(re," ").trim().split(' ');
        for(var i=0;i<arr.length;i++){

        }
    }
   console.log(decodeString(s));



</script>
</body>
</html>